<?php
/**
 * 单店基金-项目活动-项目定额
 * @author jianhui
 *
 */
class singlePFixedModel extends MY_Model{
    function singlePFixedModel(){
        parent::MY_Model();
        $this->table = 'SinglePFixed';
    }
    /**
     * 获取制定条件的制定项目额度
     * @param integer $storeId 店铺ID
     * @param integer $year 年份
     * @param integer $eventType 项目类型
     * @return number
     */
    function getMoney($storeId, $year, $eventType){
        $this->CI->load->model('sellpointModel');
        $storeData = $this->CI->sellpointModel->getStoreIdData($storeId);
        $findData = $this->getData(array('year'=>$year,'systemCity'=>$storeData['city']));
        if (!$findData) {
            $findData = $this->getData(array('year'=>$year,'city'=>$storeData['city']));
        }
        if ($findData){
            return $eventType == 1 ? (float)$findData['diantouMoney'] : (float)$findData['huwaiMoney'];
        }else{
            return 0;
        }
    }
}